<?php
/**
 * setup a HTMLFilter to filter the Body with allowed tags..
 * this has to match the "Full" toolbar sets of FckEditor
 */

class Clu_Filter_HtmlBody extends Clu_Filter_HTMLPurifier
{
    
    public function __construct($newOptions = null)
    {
        
        $options = array(
            array('Cache', 'SerializerPath',
                APP_PATH. '/cache/htmlpurifier'
            ),
            array('HTML', 'Doctype', 'XHTML 1.0 Strict'),
            array('HTML', 'Allowed',
                'p[style|class],em,h1,h2,h3,h4,h5,strong,b,i,u,a[href],ul,ol,li,code,pre,'
                .'blockquote,img[src|alt|height|width|style],sub,sup,span[class|style],br,'.
                'div[class|style]'
            ),
            array('AutoFormat', 'Linkify', 'true'),
            array('AutoFormat', 'AutoParagraph', 'false'),
            //array('URI', 'Munge', 'true'),
            //array('URI', 'MungeResources', 'true'),
            //array('URI', 'Hvn', 'true'),
            //array('Filter', 'YouTube', 'true'),
            
            //array('HTML', 'DefinitionID', 'Hvn'),
			//array('HTML', 'DefinitionRev', '1'),
			//array('Cache', 'DefinitionImpl', null) //TODO remove this later!
        );
        
        if (!is_null($newOptions)) {
            // I'll let HTMLPurifier overwrite original options
            // with new ones rather than filter them myself
        	$options = array_merge($options, $newOptions);
        }
        
        parent::__construct($options); 
    }

}